package com.task.manage.system.service.impl;

import java.util.List;

import com.task.manage.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.task.manage.system.mapper.MerchantTaskPriorityMapper;
import com.task.manage.system.domain.MerchantTaskPriority;
import com.task.manage.system.service.IMerchantTaskPriorityService;
import com.task.manage.common.core.text.Convert;

/**
 * 商家任务优先级Service业务层处理
 *
 * @author ruoyi
 * @date 2024-05-15
 */
@Service
public class MerchantTaskPriorityServiceImpl implements IMerchantTaskPriorityService {
    @Autowired
    private MerchantTaskPriorityMapper merchantTaskPriorityMapper;

    /**
     * 查询商家任务优先级
     *
     * @param id 商家任务优先级主键
     * @return 商家任务优先级
     */
    @Override
    public MerchantTaskPriority selectMerchantTaskPriorityById(Long id) {
        return merchantTaskPriorityMapper.selectMerchantTaskPriorityById(id);
    }

    /**
     * 查询商家任务优先级列表
     *
     * @param merchantTaskPriority 商家任务优先级
     * @return 商家任务优先级
     */
    @Override
    public List<MerchantTaskPriority> selectMerchantTaskPriorityList(MerchantTaskPriority merchantTaskPriority) {
        return merchantTaskPriorityMapper.selectMerchantTaskPriorityList(merchantTaskPriority);
    }

    /**
     * 新增商家任务优先级
     *
     * @param merchantTaskPriority 商家任务优先级
     * @return 结果
     */
    @Override
    public int insertMerchantTaskPriority(MerchantTaskPriority merchantTaskPriority) {
        merchantTaskPriority.setCreateTime(DateUtils.getNowDate());
        return merchantTaskPriorityMapper.insertMerchantTaskPriority(merchantTaskPriority);
    }

    /**
     * 修改商家任务优先级
     *
     * @param merchantTaskPriority 商家任务优先级
     * @return 结果
     */
    @Override
    public int updateMerchantTaskPriority(MerchantTaskPriority merchantTaskPriority) {
        merchantTaskPriority.setUpdateTime(DateUtils.getNowDate());
        return merchantTaskPriorityMapper.updateMerchantTaskPriority(merchantTaskPriority);
    }

    /**
     * 批量删除商家任务优先级
     *
     * @param ids 需要删除的商家任务优先级主键
     * @return 结果
     */
    @Override
    public int deleteMerchantTaskPriorityByIds(String ids) {
        return merchantTaskPriorityMapper.deleteMerchantTaskPriorityByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除商家任务优先级信息
     *
     * @param id 商家任务优先级主键
     * @return 结果
     */
    @Override
    public int deleteMerchantTaskPriorityById(Long id) {
        return merchantTaskPriorityMapper.deleteMerchantTaskPriorityById(id);
    }

    @Override
    public MerchantTaskPriority getMerchantTaskPriority(Long taskId) {
        return merchantTaskPriorityMapper.getMerchantTaskPriority(taskId);
    }
}
